package org.pf.base.pfSystem
{
	import Box2D.Common.Math.b2Vec2;
	import Box2D.Dynamics.b2Body;
	import Box2D.Dynamics.b2World;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.events.KeyboardEvent;
	import flash.system.System;
	import org.pf.base.pfBlocks.PFCache;
	import org.pf.base.pfBlocks.PFCleaner;
	import org.pf.base.pfBlocks.PFState;
	import org.pf.base.pfBlocks.PFUpdater;
	import org.pf.constructor.PFConstructor;
	import org.pf.base.pfSystem.PFSystemControlLayer;
	import org.pf.interfaces.IPFCache;
	import org.pf.interfaces.IPFState;
	import org.pf.interfaces.IPFSystemCache;
	
	/**
	 * ...
	 * @author
	 */
	public class PFSystemCache implements IPFSystemCache
	{
		private var _stage:Stage;
		
		private var _gWidth:int;
		private var _gHeight:int;
		
		private var _nextState:Class;
		private var _nextLevelName:String;
		private var _nextCache:Class;
		
		private var _currentWorld:b2World;
		private var _currentCache:IPFCache;
		private var _currentState:IPFState;
		
		
		private var _layers:PFSystemLayers;
		
		private var _listenersList:Array;
		
		private var _enableCamera:Boolean;
		private var _cameraTo:b2Body;
		
		private var _layersSet:Boolean;
		
		public function PFSystemCache(p_stage:Stage, p_gWidth:Number, p_gHeight:Number)
		{
			_stage = p_stage;
			_gWidth = p_gWidth;
			_gHeight = p_gHeight;
			
			_listenersList = new Array();
		}
		
		public function initLayers():void
		{
			if (_layersSet)
			{
				return;
			}
			_layers = new PFSystemLayers(_gWidth,_gHeight);
			_stage.addChild(_layers);
			_layersSet = true;
		}
		
		
		public function get nextState():Class
		{
			return _nextState;
		}
		
		public function set nextState(value:Class):void
		{
			_nextState = value;
		}
		
		public function get nextLevelName():String
		{
			return _nextLevelName;
		}
		
		public function set nextLevelName(value:String):void
		{
			_nextLevelName = value;
		}
		
		public function get nextCache():Class
		{
			return _nextCache;
		}
		
		public function set nextCache(value:Class):void
		{
			_nextCache = value;
		}
		
		public function get stage():Stage
		{
			return _stage;
		}
		
		public function set stage(value:Stage):void
		{
			_stage = value;
		}
		
		public function get currentWorld():b2World
		{
			return _currentWorld;
		}
		
		public function set currentWorld(value:b2World):void
		{
			_currentWorld = value;
		}
		
		public function get currentCache():IPFCache
		{
			return _currentCache;
		}
		
		public function set currentCache(value:IPFCache):void
		{
			_currentCache = value;
		}
		
		public function get currentState():IPFState
		{
			return _currentState;
		}
		
		public function set currentState(value:IPFState):void
		{
			_currentState = value;
		}
		
		public function get listenersList():Array
		{
			return _listenersList;
		}
		
		public function set listenersList(value:Array):void
		{
			_listenersList = value;
		}
		
		public function get enableCamera():Boolean
		{
			return _enableCamera;
		}
		
		public function set enableCamera(value:Boolean):void
		{
			_enableCamera = value;
		}
		
		public function get cameraTo():b2Body
		{
			return _cameraTo;
		}
		
		public function set cameraTo(value:b2Body):void
		{
			_cameraTo = value;
		}
		
		public function get gWidth():int
		{
			return _gWidth;
		}
		
		public function set gWidth(value:int):void
		{
			_gWidth = value;
		}
		
		public function get gHeight():int
		{
			return _gHeight;
		}
		
		public function set gHeight(value:int):void
		{
			_gHeight = value;
		}
		
		public function get layers():PFSystemLayers
		{
			return _layers;
		}
	
	}

}